import Vue from 'vue'
import Router from 'vue-router'
import about from '../components/About'
import home from '../components/Home'
import user from '../components/User'

Vue.use(Router);

const routes=[
  {
    path:'/about',
    component:about
    //懒加载模式，用到时才会去加载文件(需要删除顶端的import语句)
    //component:()=>import('../components/About')
  },
  {
    path:'/home',
    component:home
    //component:()=>import('../components/Home')

  },
  {
    //:userId 和this.$route.params里定义的一致即可
    path:'/user/:userId',
    component:user
    //component:()=>import('../components/User')
  }
];

export default new Router({
  routes,
  mode:"history",
  linkActiveClass:"active"
})
